//initialize four trash bins to have them answer to drop events
//param: a handler function to deal with the drop event captured. 
function initBins(dropHandler) {
    var bins = document.querySelectorAll('.bins>div')
    for(let i = 0; i<bins.length; i++){
        bins[i].addEventListener('dragover',function(e){
            e.preventDefault()
            e.dataTransfer.dropEffect = "move"
        })
        bins[i].addEventListener('drop', dropHandler)
    }
}


//get random position in certain area
//param 1: width, the width of the area the random position placed
//param 2: height, the height of the area the random position placed
//return: an array contains random width and random height
function getPosition(width,height) {
    return [Math.round(Math.random() * width), Math.round(Math.random() * height)];
}